/**
 * 功能说明:
 * 功能作者:
 * 创建日期:
 * 版权归属:每特教育|蚂蚁课堂所有 www.itmayiedu.com
 */
package com.lpf.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.lpf.entity.AppEntity;
import org.springframework.stereotype.Repository;

@Repository
public interface AppMapper {

    @Select("SELECT ID AS ID," +
            "   APP_NAME AS appName," +
            "   app_id as appId," +
            "   app_secret as appSecret," +
            "   is_flag as isFlag," +
            "   access_token as accessToken " +
            "from m_app " +
            "where app_id=#{appId} and app_secret=#{appSecret}")
    AppEntity findApp(AppEntity appEntity);


    @Select("SELECT ID AS ID," +
            "   APP_NAME AS appName," +
            "   app_id as appId," +
            "   app_secret as appSecret," +
            "   is_flag as isFlag," +
            "   access_token as accessToken " +
            "from m_app " +
            "where app_id=#{appId}")
    AppEntity findAppId(@Param("appId") String appId);


    @Update("update m_app set access_token = #{accessToken} where app_id = #{appId} ")
    int updateAccessToken(@Param("accessToken") String accessToken, @Param("appId") String appId);
}
